//
//  DetailInterfaceController.swift
//  WatchKitPreview
//
//  Created by wrl on 15/8/27.
//  Copyright (c) 2015年 王儒林. All rights reserved.
//

import WatchKit
import Foundation


class DetailInterfaceController: WKInterfaceController {

    @IBOutlet weak var label: WKInterfaceLabel!
    
    override func awakeWithContext(context: AnyObject?) {
        super.awakeWithContext(context)
    }

    override func willActivate() {
        // This method is called when watch view controller is about to be visible to user
        super.willActivate()
    }

    override func didDeactivate() {
        // This method is called when watch view controller is no longer visible
        super.didDeactivate()
    }
    @IBAction func openParent() {
        DetailInterfaceController.openParentApplication([:], reply: { (dict : [NSObject : AnyObject]!, error : NSError!) -> Void in
            self.label.setText(dict["key"]!.description)
        })
    }
    @IBAction func inputClick() {
        presentTextInputControllerWithSuggestions(["aaa","bbb"], allowedInputMode:.AllowAnimatedEmoji ,completion: { (results) -> Void in
            if results.count > 0 {
                if let fstObj: String = results[0] as? String {
                    self.label.setText(fstObj)
                } else if let otherObj: AnyObject = results[0] as AnyObject? {
//                    NSSubrangeData
                    self.label.setText("\(otherObj.dynamicType)")
                }
            }
        })
    }

}
